import Book.BookList;
import user.Aminder;
import user.Nomaluser;
import user.User;

import java.util.Scanner;

public class Main {

    public static User test(){

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的名字：");
        String name = scanner.nextLine();
        System.out.println("请输入你的身份：1、管理员  0、用户");
        int ret1 = scanner.nextInt();
        User user;
        if(ret1 == 1){
             user = new Aminder(name);//向上转型
        }
        else {
             user = new Nomaluser(name);
        }
        scanner.nextLine();

        return user;
    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = test();
        while(true) {
            int choice = user.menu();
            user.doIoperation(choice, bookList);
        }
    }
}
